﻿/*  CamHelper (See http://camhelper.codeplex.com/ or https://bitbucket.org/AndiKS/camhelper for more Info)
    Copyright (C) 2011 Andreas Wimmer

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

using CamHelper.Engine;
using CamHelper.Facade.TopSolid.Interfaces;
using NUnit.Framework;
using Rhino.Mocks;

namespace CamHelper.Tests.Engine
{
    public class StandardComponentTest
    {
        [Test]
        public void Constructor()
        {
            var designation = "the Test designation";
            var code = "the test Code";
            var fullname = @"$STD=Company\Vices\Categorie#V=CustomType#I=1#R=NR.top";

            var compMock = MockRepository.GenerateMock<ITSComponent>();
            compMock.Expect(x => x.Element.Designation).Return(designation);
            compMock.Expect(x => x.Code).Return(code);
            compMock.Expect(x => x.IsStandard).Return(true);
            var docMock = MockRepository.GenerateMock<ITSDocument>();
            docMock.Expect(x => x.FullName).Return(fullname);
            compMock.Expect(x => x.TemplateDocument).Return(docMock);

            var comp = new StandardComponent(compMock);

            Assert.That(comp.Designation, Is.EqualTo(designation));
            Assert.That(comp.Code, Is.EqualTo(code));
            Assert.That(comp.FullName, Is.EqualTo(fullname));
        }
    }
}
